In triangle $ABC$, $BC = 8$.  The length of median $AD$ is 5.  Let $M$ be the largest possible value of $AB^2 + AC^2$, and let $m$ be the smallest possible value.  Find $M - m$.
Answer: Since $AD$ is a median, $D$ is the midpoint of $BC$, so $BD = CD = 4$.  Let $P$ be the projection of $A$ onto $BC$.  (Without loss of generality, we may assume that $P$ lies on $BD$.)  Let $x = BP$, so $PD = 4 - x$.  Let $h = AP$.

[asy]
unitsize(0.4 cm);

pair A, B, C, D, P;

A = (4,12);
B = (0,0);
C = (14,0);
D = (B + C)/2;
P = (A + reflect(B,C)*(A))/2;

draw(A--B--C--cycle);
draw(A--D);
draw(A--P);

label("$A$", A, dir(90));
label("$B$", B, SW);
label("$C$", C, SE);
label("$D$", D, SE);
label("$P$", P, SW);

label("$x$", (B + P)/2, S);
label("$4 - x$", (P + D)/2, S);
label("$4$", (D + C)/2, S);
label("$5$", (A + D)/2, E);
label("$h$", (A + P)/2, W);
[/asy]

Then by Pythagoras on right triangles $APB$, $APC$, and $APD$, \begin{align*}
AB^2 &= x^2 + h^2, \\
AC^2 &= (8 - x)^2 + h^2, \\
25 &= (4 - x)^2 + h^2.
\end{align*}Adding the first two equations, we get \[AB^2 + AC^2 = x^2 + h^2 + (8 - x)^2 + h^2 = 2x^2 - 16x + 64 + 2h^2.\]But from the third equation, $25 = x^2 - 8x + 16 + h^2$, so \begin{align*}
AB^2 + AC^2 &= 2x^2 - 16x + 64 + 2h^2 \\
&= 2(x^2 - 8x + 16 + h^2) + 32 \\
&= 2 \cdot 25 + 32 \\
&= 82.
\end{align*}Hence, from the given data, $AB^2 + AC^2$ can only take on the value 82.  Therefore, $M = m = 82$, so $M - m = \boxed{0}$.